package cn.edu.ctbu.dp01.dao;

import cn.edu.ctbu.dp01.entity.Course;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CourseReposity extends JpaRepository<Course,Long> {
    @Query(value = "SELECT s.`name` AS student_name, c.`name` AS course_name FROM `tb_student` s " +
            "INNER JOIN " +
            "`course` c ON s.`cid` = c.`id`;",nativeQuery = true)
    List<Object[]> findCourseAndStudent();
}
